<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="author" content="wangbo">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>from组件</title>
</head>

<body>
    <div id="app">

    </div>
    <script src="../js/react.development.js"></script>
    <script src="../js/react-dom.development.js"></script>
    <script src="../js/prop-types.js"></script>
    <script src="../js/babel.min.js"></script>
    <script type="text/babel">
        class Myform extends React.Component {
            sub = (event) => {
                const val = this.mye.value;
                // 阻止默认事件
                event.preventDefault()
            }
            
            render() {
                return (
                    <form action="https://baidu.com" onSubmit={this.sub}  method="get">
                        用户名<input type="text" ref={e => this.mye = e} /> <br />
                        密码 <input type="text"  /> <br />
                        <input type="submit" value="提交" />
                    </form>
                )
            }
        }
        ReactDOM.render(<Myform />, document.getElementById('app'))
    </script>



</body>

</html>